package com.itheima.mapper;

import com.itheima.common.vo.SetmealVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

@Mapper
public interface ReportMapper {

    @Select("select reg_time from member")
    List<Date> getRegTime();

    @Select("select count(id) from member where reg_time between #{firstDay} and #{lastDay}")
    Integer getMemberCount(Date firstDay, Date lastDay);

    //根据套餐名称分组统计订单数量
    @Select("select s.name as name,count(s.name) as value from setmeal s join `order` o on s.id = o.setmeal_id group by s.name")
    List<SetmealVo> getSetmealCount();
}
